package com.qding.park.adapter.report.conf;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import com.baidu.disconf.client.common.annotations.DisconfFile;
import com.baidu.disconf.client.common.annotations.DisconfFileItem;

/**
 * @author Administrator
 *服务器   窗口配置参数
 */
@Service
@Scope("singleton")
@DisconfFile(filename = "server.properties")
public class ServerConfig {
	
	/**
	 * 服务 linster  port
	 */
	private int port=9084;
	
	/**
	 * 最大连接数
	 */
	private int maxConnections=75;
	
	/**
	 * 最大线程数
	 */
	private int maxThreads=3;
	
	/**
	 * 连接超时  时间  以毫秒为单位
	 */
	private int connectionTimeout=30000;
	
	/**
	 * url 编码
	 */
	private String  uriEncoding="utf-8";
	
	/**
	 * 的意思就是如果空闲状态的线程数多于设置的数目，则将这些线程中止，减少这个池中的线程总数。
	 */
	private int sniParseLimit;
	
	/**
	 * 最小备用线程数，tomcat启动时的初始化的线程数。
	 */
	private int minSpareThreads;
	
	/**
	 * 为了消除DNS查询对性能的影响我们可以关闭DNS查询，方式是修改server.xml文件中的enableLookups参数值。
	 */
	private boolean enableLookups;
	
	/**
//	 * acceptCount是当线程数达到maxThreads后，后续请求会被放入一个等待队列，这个acceptCount是这个队列的大小，如果这个队列也满了，就直接refuse connection
//	 */
//	private int acceptCount;

	@DisconfFileItem(name = "embedded.server.port",associateField ="port")
	public int getPort() {
		return port;
	}

	public void setPort(int port) {
		this.port = port;
	}

	@DisconfFileItem(name = "embedded.server.maxConnections",associateField ="maxConnections")
	public int getMaxConnections() {
		return maxConnections;
	}

	public void setMaxConnections(int maxConnections) {
		this.maxConnections = maxConnections;
	}
	
	@DisconfFileItem(name = "embedded.server.maxThreads",associateField ="maxThreads")
	public int getMaxThreads() {
		return maxThreads;
	}

	public void setMaxThreads(int maxThreads) {
		this.maxThreads = maxThreads;
	}
	
	@DisconfFileItem(name = "embedded.server.connectionTimeout",associateField ="connectionTimeout")
	public int getConnectionTimeout() {
		return connectionTimeout;
	}

	public void setConnectionTimeout(int connectionTimeout) {
		this.connectionTimeout = connectionTimeout;
	}
	
	@DisconfFileItem(name = "embedded.server.uriEncoding",associateField ="uriEncoding")
	public String getUriEncoding() {
		return uriEncoding;
	}

	public void setUriEncoding(String uriEncoding) {
		this.uriEncoding = uriEncoding;
	}

	@DisconfFileItem(name = "embedded.server.sniParseLimit",associateField ="sniParseLimit")
	public int getSniParseLimit() {
		return sniParseLimit;
	}

	public void setSniParseLimit(int sniParseLimit) {
		this.sniParseLimit = sniParseLimit;
	}
	
	@DisconfFileItem(name = "embedded.server.minSpareThreads",associateField ="minSpareThreads")
	public int getMinSpareThreads() {
		return minSpareThreads;
	}

	public void setMinSpareThreads(int minSpareThreads) {
		this.minSpareThreads = minSpareThreads;
	}
	
	@DisconfFileItem(name = "embedded.server.enableLookups",associateField ="enableLookups")
	public boolean isEnableLookups() {
		return enableLookups;
	}

	public void setEnableLookups(boolean enableLookups) {
		this.enableLookups = enableLookups;
	}
	
//	@DisconfFileItem(name = "embedded.server.acceptCount",associateField ="acceptCount")
//	public int getAcceptCount() {
//		return acceptCount;
//	}
//
//	public void setAcceptCount(int acceptCount) {
//		this.acceptCount = acceptCount;
//	}
	
	
	
}
